// 业务组件
import OptionSelect from '@/components/Survey/Materials/SelectComs/OptionSelect.vue';

// 编辑组件
import TitleEditor from '@/components/Editor/TitleEditor.vue';
import DescEditor from '@/components/Editor/DescEditor.vue';
import OptionsEditor from '@/components/Editor/OptionsEditor.vue';
import PositionEditor from '@/components/Editor/PositionEditor.vue';
import SizeEditor from '@/components/Editor/SizeEditor.vue';
import WeightEditor from '@/components/Editor/WeightEditor.vue';
import ItalicEditor from '@/components/Editor/ItalicEditor.vue';
import ColorEditor from '@/components/Editor/ColorEditor.vue';

import { markRaw } from 'vue';
import { v4 as uuidv4 } from 'uuid';

import type { Status } from '@/types';

// 每个业务组件独立
export default function (): Status {
  return {
    // 用 markRaw 将响应式对象转为普通对象，避免不必要的更新
    type: markRaw(OptionSelect),
    name: 'option-select',
    id: uuidv4(),
    // 组件的状态：组件的每一个可以修改的状态都应该对应一个编辑组件
    status: {
      title: {
        id: uuidv4(),
        status: '下拉选择题默认标题',
        isShow: true,
        name: 'title-editor',
        editCom: markRaw(TitleEditor),
      },
      desc: {
        id: uuidv4(),
        status: '下拉选择题默认描述',
        isShow: true,
        name: 'desc-editor',
        editCom: markRaw(DescEditor),
      },
      options: {
        id: uuidv4(),
        currentStatus: 0,
        status: ['默认选项1', '默认选项2'],
        isShow: true,
        name: 'options-editor',
        editCom: markRaw(OptionsEditor),
      },
      position: {
        id: uuidv4(),
        currentStatus: 0,
        status: ['左对齐', '居中对齐'],
        isShow: true,
        name: 'position-editor',
        editCom: markRaw(PositionEditor),
      },
      titleSize: {
        id: uuidv4(),
        currentStatus: 0,
        status: ['22', '20', '18'],
        isShow: true,
        name: 'size-editor',
        editCom: markRaw(SizeEditor),
      },
      descSize: {
        id: uuidv4(),
        currentStatus: 0,
        status: ['16', '14', '12'],
        isShow: true,
        name: 'size-editor',
        editCom: markRaw(SizeEditor),
      },
      titleWeight: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['加粗', '正常'],
        isShow: true,
        name: 'weight-editor',
        editCom: markRaw(WeightEditor),
      },
      descWeight: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['加粗', '正常'],
        isShow: true,
        name: 'weight-editor',
        editCom: markRaw(WeightEditor),
      },
      titleItalic: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['斜体', '正常'],
        isShow: true,
        name: 'italic-editor',
        editCom: markRaw(ItalicEditor),
      },
      descItalic: {
        id: uuidv4(),
        currentStatus: 1,
        status: ['斜体', '正常'],
        isShow: true,
        name: 'italic-editor',
        editCom: markRaw(ItalicEditor),
      },
      titleColor: {
        id: uuidv4(),
        status: '',
        isShow: true,
        name: 'color-editor',
        editCom: markRaw(ColorEditor),
      },
      descColor: {
        id: uuidv4(),
        status: '#909399',
        isShow: true,
        name: 'color-editor',
        editCom: markRaw(ColorEditor),
      },
    },
  };
}
